package project.Service;/*
 *  @Author Mr.long
 *  @QQ 1507468405
 *  @Creat 2021/11/26 - 12:34
 */

import org.json.JSONObject;
import project.userAED.userExportServlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "ExportMeetServlet", value = "/ExportMeetServlet")
public class ExportMeetServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        service(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        service(request,response);
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String filename = "export_meeting.xls";
        JSONObject ret = new userExportServlet().Export(req, filename);
        //将响应消息返回页面
        resp.setContentType("text/html; charset=UTF-8");
        resp.getWriter().print(ret);
        resp.getWriter().flush();
        resp.getWriter().close();
    }
}
